import request from "./request/request";
import {IComponent} from "@bastet/widgets";

export interface IScene {
    id?: string
    name: string
    description?: string
    widgets?: IComponent[];
}
interface ISceneResponse {
    data: IScene[]
    code: number;
}

// 新增
export function addScene (data: IScene): Promise<ISceneResponse> {
    return request.post('/scene', data)
}

// 列表
export function getScenes (): Promise<ISceneResponse> {
    return request.get('/scene/list')
}

// 更新
export function updateScene (data: IScene) {
    return request.put(`/scene/${data.id}`, data)
}

// 详情
export function getScene (id: string) {
    return request.get(`/scene/${id}`)
}

// 删除
export function removeScene (id: string) {
    return request.delete(`/scene/${id}`)
}